// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

int t, n;

int main(int argc, char const *argv[]) {
    // code
    int t;
    scanf("%d", &t);
    for (int kk=0; kk<t; ++kk) {
        int c, m, x;
        scanf("%d%d%d", &c, &m, &x);
        int y = min(c, m), remain = x + max(c, m) - y;
        // y = min(y, remain);

        int times = (y - remain + 2) / 3;
        times = max(times, 0); times = min(times, y);
        // dbg(y, remain, times);
        y -= times;
        remain += times * 2;
        printf("%d\n", min(y, remain));
    }
    return 0;
}
